package com.itboye.jmsfhz.data.repository;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest.Builder;
import com.itboye.jmsfhz.data.interfaces.ILunBo;
import com.itboye.jmsfhz.data.interfaces.IPrisenter;
import com.itboye.jmsfhz.data.interfaces.IProjectrisenter;
import com.itboye.jmsfhz.data.model.HomePageModel;
import com.itboye.jmsfhz.data.model.LunBoModel;
import com.itboye.jmsfhz.data.model.MeTouGuoDeBean;
import com.itboye.jmsfhz.data.model.ProjectBean;
import com.lfh.commentdemo.bean.AppModelNewsBean;

public class ProjectrRepository extends BaseNetRepository implements
		IProjectrisenter<ProjectBean> {
	
	public  static final String ProjectNice="By_Project_query";
	public  static  final  String MeTou="By_CompanyApplyInfo_apply";
	
	public  static  final  String JianLi="By_CompanyEmploy_apply";
	public static  final  String Project="By_Project_apply";
	static final String CompanyApplyInfo = "By_CompanyApplyInfo_receive"; //我收到的
	String api = "100";

	public ProjectrRepository(ICompleteListener listener) {
		// TODO Auto-generated constructor stub
		super(listener);
	}

	@Override
	public void add(ProjectBean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ProjectBean>() {
		}.getType();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", model.getUid());
		map.put("page_num", model.getPage_num());
		map.put("page_size",model.getPage_size());
		map.put("keyword", model.getKeyword());
		(new Builder<ProjectBean>())
				.setTypeVerParamsAndReturnClass(ProjectNice, api, map, type)
				.requestListener(
						new BaseSuccessReqListener<ProjectBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void delete(ProjectBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(ProjectBean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ProjectBean>() {
		}.getType();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", model.getUid());
		map.put("page_num", model.getPage_num());
		map.put("page_size",model.getPage_size());
		(new Builder<ProjectBean>())
				.setTypeVerParamsAndReturnClass(ProjectNice, api, map, type)
				.requestListener(
						new BaseSuccessReqListener<ProjectBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}
	@Override
	public void getInfo(ProjectBean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ProjectBean>() {
		}.getType();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", model.getUid());
		map.put("page_num", model.getPage_num());
		map.put("page_size",model.getPage_size());
		(new Builder<ProjectBean>())
				.setTypeVerParamsAndReturnClass(ProjectNice, api, map, type)
				.requestListener(
						new BaseSuccessReqListener<ProjectBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public List<ProjectBean> query(ProjectBean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void getTou(String uid) {
		// TODO Auto-generated method stub MeTouGuoDeBean
		Type type = new TypeToken<MeTouGuoDeBean>() {
		}.getType();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
//		map.put("page_num", page_num);
//		map.put("page_size",page_size);
		(new Builder<MeTouGuoDeBean>())
				.setTypeVerParamsAndReturnClass(MeTou, api, map, type)
				.requestListener(
						new BaseSuccessReqListener<MeTouGuoDeBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void getJianLi(String uid, String id) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("id", id);
//		map.put("page_num", page_num);
//		map.put("page_size",page_size);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(JianLi, api, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}
	
	@Override
	public void getProject(String uid, String id) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("project_id", id);
//		map.put("page_num", page_num);
//		map.put("page_size",page_size); static final String CompanyApplyInfo = "By_CompanyApplyInfo_receive"; //我收到的
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(Project, api, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void getShouDao(String uid, String page_num, String page_size) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("page_size", page_size);
		map.put("page_num", page_num);
//		map.put("page_num", page_num);
//		map.put("page_size",page_size); static final String CompanyApplyInfo = "By_CompanyApplyInfo_receive"; //我收到的
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(CompanyApplyInfo, api, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

}
